package com.fengye.algorithms.leecode;

import java.util.Arrays;

/**
 * @Author fengye
 * @Date 2023/4/10 9:41
 **/
public class CanMakeArithmeticProgression1502 {
    public boolean canMakeArithmeticProgression(int[] arr) {
        if(arr.length < 2) {
            return false;
        }
        Arrays.sort(arr);

        int n = arr[1] - arr[0];
        for(int i = 1;i<arr.length;i++) {
            if(arr[i-1] + n != arr[i] ) {
                return false;
            }
        }

        return true;
    }
}
